* JI YEON HONG, CECILIA HYUNJUNG MO, CHRISTOPHER PAIK
* July 25, 2023
* Replication File for: "Can a Sense of Shared War Experience? Increase Refugee Acceptance?"
* Journal of Conflict Resolution #JCR-23-0034


************************************************************************ OPEN DATA
use "/Users/moch/Dropbox/Korea_Refugee/Analysis/Replication/mainsurvey_2019.dta", clear
capture cd "/Users/moch/Dropbox/Korea_Refugee/Analysis/Replication"
* cd "C:\Users\jyhong\Dropbox\Research\1. Korea_Refugee\Analysis\Replication"
* cd "/Users/jeansmacair/Dropbox/Research/1. Religion (Korea)/data/Analysis/Replication"


************************************************************************ INSTALL PACKAGES
ssc install sutex
ssc install blindschemes
ssc install coefplot
ssc install orth_out
ssc install outreg2
ssc install medeff
************************************************************************ GENERATE VARIABLES

***** COVARIATES
gen problem = 1 if war_exp == 1 & war_fam_exp == 2

* MARRIED DUMMY
gen married = marital == 2 | marital == 3
recode married (.=0) if marital !=.

* COLLEGE DUMMY
gen college = 1 if school == 5 | school == 6
recode college (.=0) if school !=.

* LN(INCOME)
gen ln_income = ln(DQ11)

* CHILDREN
gen kids = DQ2 
gen children = 1 if DQ2 !=.
replace children = 0 if DQ2 ==.

* RELIGION (baseline = no religion)
gen buddhist = religion == 1
gen protestant = religion ==2
gen catholic = religion == 3
gen otherrelig = religion ==4
 
* MILITARY EXPERIENCE
gen military_exp1 = DQ6 < 3
replace military_exp1 = 0 if  DQ6 >2

* GENDER: 2 = female; 1 = male
gen female = (gender-1)
gen male = 1 if gender == 1
replace male = 0 if gender == 2

* REGION
tabulate SQ4, generate(res)

* AGE SQUARED
gen age_sq = age * age

* AGE BUCKETS
gen age1 = 1 if age >=18 & age <= 29
recode age1 (.=0) if age > 29 & age != .

gen age2 = 1 if age >=30 & age <= 39
recode age2 (.=0) if (age1 == 1 | age > 39) & age != .

gen age3 = 1 if age >=40 & age <= 49
recode age3 (.=0) if (age1 == 1 | age2==1 | age > 49) & age != .

gen age4 = 1 if age >=50 & age <= 59
recode age4 (.=0) if (age1 == 1 | age2==1 | age3 == 1 | age > 59) & age != .

gen age5 = 1 if age >=60 & age != .
recode age5 (.=0) if (age1 == 1 | age2==1 | age3 == 1 | age4 == 1) & age != .

* PARTY FEELING THERMOMETER
gen conservative = C29_2/100 
gen liberal = C29_1/100
gen progressive =  C29_5/100  

* LABELING VARIABLES
label var age "Age"
label var age_sq "Age^2"
label var female "Female"
label var ideo "Ideology (Liberal $\rightarrow$ Conservative)"
label var conservative "Feeling Thermometer: Liberty Korea Party"
label var liberal "Feeling Thermometer: Democratic Party of Korea"
label var progressive "Feeling Thermometer: Justice Party"
label var military_exp1 "Served in Military"
label var ln_income "Logged Income"
label var married "Married"
label var college "Completed 4-Year College"
label var buddhist "Buddhist"
label var protestant "Protestant"
label var catholic "Catholic"
label var otherrelig "Identify with Another Religion" 
label var rel_freq "Religiosity"
label var children "Have Children"
label var res1 "Seoul"
label var res2 "Kyeungido"
label var res3 "Incheon"
label var res4 "Daejeon"
label var res5 "North Cheungchung"
label var res6 "South Cheungchung"
label var res7 "Sejong"
label var res8 "Kwangju"
label var res9 "North Jeolla"
label var res10 "South Jeolla"
label var res11 "Daeku"
label var res12 "Ulsan"
label var res13 "North Gyeongsang"
label var res14 "South Gyeongsang"
label var res15 "Pusan"
label var res16 "Gangwon"
label var res17 "Jeju"

***** WAR/REFUGEE EXPERIENCE
* RECODE WAR MEASURES
gen war = 1 if war_exp == 1
replace war = 0 if war_exp == 2
replace war = 1 if war_fam_exp == 1
recode war (.=0) if war_fam_exp == 2

gen war_exp2 = war_exp
replace war_exp2 = 0 if war_exp == 2

gen war_fam_exp2 = war_fam_exp
replace war_fam_exp2 = 0 if war_fam_exp == 2

gen northbirth =  DQ3 == 18 |DQ4==18|DQ5 ==18
gen northbirth1 = (DQ3 == 18 |DQ4==18|DQ5 ==18)&war == 1

label var war "Experienced War"
label var northbirth "Displaced by War"

***** TREATMENT VARIABLES
gen shame = 1 if Code_1 == 1
replace shame = 0 if Code_1 > 1 & Code_1 !=.

gen sympathy = 1 if Code_1 == 2
replace sympathy = 0 if Code_1 == 1 | Code_1 == 3 | Code_1 == 4

gen economy = 1 if Code_1 == 3
replace economy = 0 if Code_1 == 1 | Code_1 == 2 | Code_1 == 4

gen persp = 1 if Code_2 == 1
replace persp = 0 if Code_2 == 2

gen control = shame ==0&sympathy ==0&economy == 0

gen group = 1 if shame == 0 & sympathy == 0 & economy == 0 & persp == 0
replace group = 2 if sympathy == 1 & persp == 0
replace group = 3 if shame == 1 & persp == 0
replace group = 4 if economy == 1 & persp == 0
replace group = 5 if shame == 0 & sympathy == 0 & economy == 0 & persp == 1
replace group = 6 if sympathy == 1 & persp == 1
replace group = 7 if shame == 1 & persp == 1
replace group = 8 if economy == 1 & persp == 1

tabulate group, generate(group)

* LABELING VARIABLES
label define names 1 "Control" 2 "Shared Experience Message" 3  "Underperformance Information" 4  "Economic Information" 5  "Perspective-Taking (PT)" 6  "Shared Experience Message + PT" 7  "Underperformance Information + PT"  8 "Economic Information + PT"
label val group names

label var group1 "Control Group"
label var group2 "Shared Experience Message" 
label var group3 "Underperformance Information"
label var group4 "Economic Information" 
label var group5 "Perspective-Taking (PT)"
label var group6 "Shared Experience Message + PT" 
label var group7 "Underperformance Information + PT"
label var group8 "Economic Information + PT"

gen group1_pro = group1*protestant
gen group2_pro = group2*protestant
gen group3_pro = group3*protestant
gen group4_pro = group4*protestant
gen group5_pro = group5*protestant
gen group6_pro = group6*protestant
gen group7_pro = group7*protestant
gen group8_pro = group8*protestant

***** OUTCOME MEASURES
gen C3_v2 = 5-C3
gen C11_v2 = 5-C11

foreach var of varlist C1 C2 D4 {
	gen `var'_recode = (`var'-1)/4
	}

foreach var of varlist C3_v2 C5 {
	gen `var'_recode = (`var'-1)/3
	}

gen C11_v2_recode = C11_v2/4

gen C13_recode2 = (5-C13)

local immvars_recode2 "C2_recode C3_v2_recode C5_recode C11_v2_recode D4_recode"
egen avgimm_recode2 = rmean(`immvars_recode2')
gen avgimm_recode2_v2 = (C2_recode + C3_v2_recode + C5_recode + C11_v2_recode + D4_recode)/5

* CRONBACH'S ALPHA FOR THE PRO-REFUGEE INDEX
alpha C2_recode C3_v2_recode C5_recode C11_v2_recode D4_recode

***** MANIPULATION CHECK 
set more off
foreach var of varlist C6 C7 C12 {
	gen `var'_recode = (`var'-1)/4
	}

foreach var of varlist C15 C30 {
	gen `var'_recode = (`var'-1)/3
	}

gen C19_recode = (C19-1)/6

foreach var of varlist C13{
	gen `var'_recode = (`var'-1)/4
	}

gen know_share = E4 == 2

* LABELING VARIABLES	
label var C2 "Increase Number of Asylum Seeker"
label var C3_v2 "Increase Number of Refugees"
label var D4 "Accept Yemeni Refugees"
label var C5 "Send Aid to Assist Refugees"
label var C11_v2 "Spending on Refugees a Priority"
label var avgimm_recode2 "Pro-Refugee Index"
label var C13 "Koreans Have Suffered More than Others"
label var know_share "Correct Number of Asylum Seekers"
label var C7 "Refugees Can Help Economy"
label var C20 "Refugees Do Not Pose as Cultural Threat"
label var C21 "Refugees Do Not Pose as Crime Threat"
label var C22 "Refugees Do Not Pose as Security Threat"
label var C30 "Policy Attitude: University Admissions"


************************************************************************ ANALYSIS
set scheme plotplain 

global control age age_sq female ideo conservative liberal progressive military_exp1 ln_income married children college buddhist protestant catholic otherrelig rel_freq res1 res2 res3 res4 res5 res6 res7 res8 res9 res10 res11 res12 res13 res14 res15 res16 group1_pro-group7_pro

global control2 age female ideo conservative liberal progressive military_exp1 ln_income married children college buddhist protestant catholic otherrelig rel_freq res1 res2 res3 res4 res5 res6 res7 res8 res9 res10 res11 res12 res13 res14 res15 res16


************************* TABLES *************************

***** TABLE A.1: SAMPLE REPRESENTATIVENESS
su age1-age5 male female res*
sutex age1-age5 male female res*, lab nobs key(descstat) replace file(TableA1.tex) title("Summary Statistics")

***** TABLE A.3: SUMMARY STATISTICS OF ASSIGNMENT AND OUTCOME MEASURES
xi: sutex group1-group8 avgimm_recode2 C2 C3_v2 D4 C5 C11_v2 C13 know_share C7 C20 C21 C22 C30, lab nobs key(descstat) replace file(TableA3.tex) title("Summary Statistics") minmax 

***** TABLE A.4: SUMMARY STATISTICS OF DEMOGRAPHIC CHARACTERISTICS
sutex war northbirth age female ideo conservative liberal progressive military_exp1 ln_income married children college buddhist protestant catholic otherrelig rel_freq res*, lab nobs key(descstat) replace file(TableA4.tex) title("Summary Statistics") minmax 

***** TABLE A.5: BALANCE TEST BY TREATMENT GROUP
orth_out war northbirth $control2 using balancetest_all.tex, by(group) proportion test replace latex

***** TABLE A.6: BALANCE TEST ON WAR EXPERIENCE
orth_out $control2 using balancetest_war.tex, by(war) pcompare proportion replace latex

***** TABLE A.7: BALANCE TEST ON NORTH KOREA ORIGIN
orth_out $control2 using balancetest_nk.tex, by(northbirth) pcompare proportion replace latex

***** TABLE A.8: MAIN EFFECTS
reg avgimm_recode2 group2-group8, robust 
outreg2 using main_index.tex, se bdec(3) alpha(0.01,.05,.1) label replace
reg avgimm_recode2 group2-group8 war northbirth $control, robust 
outreg2 using main_index.tex, se bdec(3) alpha(0.01,.05,.1) label append

reg C2_recode group2-group8, robust 
outreg2 using main_index.tex, se bdec(3) alpha(0.01,.05,.1) label append
reg C2_recode group2-group8 war northbirth $control, robust 
outreg2 using main_index.tex, se bdec(3) alpha(0.01,.05,.1) label append

reg C3_v2_recode group2-group8, robust 
outreg2 using main_index.tex, se bdec(3) alpha(0.01,.05,.1) label append
reg C3_v2_recode group2-group8 war northbirth $control, robust 
outreg2 using main_index.tex, se bdec(3) alpha(0.01,.05,.1) label append

reg C5_recode group2-group8, robust 
outreg2 using main_index.tex, se bdec(3) alpha(0.01,.05,.1) label append
reg C5_recode group2-group8 war northbirth $control, robust 
outreg2 using main_index.tex, se bdec(3) alpha(0.01,.05,.1) label append

reg D4_recode group2-group8, robust 
outreg2 using main_index.tex, se bdec(3) alpha(0.01,.05,.1) label append
reg D4_recode group2-group8 war northbirth $control, robust 
outreg2 using main_index.tex, se bdec(3) alpha(0.01,.05,.1) label append

reg C11_v2_recode group2-group8, robust 
outreg2 using main_index.tex, se bdec(3) alpha(0.01,.05,.1) label append
reg C11_v2_recode group2-group8 war northbirth $control, robust 
outreg2 using main_index.tex, se bdec(3) alpha(0.01,.05,.1) label append

***** TABLE A.9: INTERACTIVE EFFECTS
reg avgimm_recode2 group2-group8 i.group##war $control , robust
outreg2 using interac_index.tex, se bdec(3) alpha(0.01,.05,.1) label replace
reg avgimm_recode2 group2-group8 i.group##northbirth $control , robust
outreg2 using interac_index.tex, se bdec(3) alpha(0.01,.05,.1) label append
reg avgimm_recode2 group2-group8 i.group##war i.group##northbirth $control , robust
outreg2 using interac_index.tex, se bdec(3) alpha(0.01,.05,.1) label append


************************* FIGURES *************************

***** FIGURE 1
reg avgimm_recode2 i.group war northbirth $control, robust 
estimate store main_index_2
test 2.group = 5.group

* coefficient size of shared message as % of the average of the main outcome measure and cohen's d
su avgimm_recode2 
di  .0646654/.396875
di  .0646654/.2290535

coefplot  (main_index_2), title("Pro-Refugee Index", size(small)) levels(95 90) msym(s) mfcolor(white) ciopts(lwidth(*1 *3)) keep(2.group 3.group 4.group 5.group 6.group 7.group 8.group war northbirth) xlabel(-0.1(0.05)0.15) byopts(xrescale) xline(0) drop(_cons) headings(2.group = "{bf:Treatment}" war = "{bf:Conflict Experience}")
graph export "main_index_all_ref.pdf", replace

***** FIGURE 2
reg avgimm_recode2 i.group i.group##war i.group##northbirth $control , robust
estimate store int_index_all

* coefficient size of interaction between shared experience message and displaced by war cohen's d
su avgimm_recode2 
di  .1992595/.396875
di  .1992595/.2290535

coefplot (int_index_all), title("Pro-Refugee Index", size(small)) levels(95 90) msym(s) mfcolor(white) ciopts(lwidth(*1 *3)) byopts(xrescale) xline(0) drop($control group1_pro group2_pro group3_pro group4_pro group5_pro group6_pro group7_pro group8_pro _cons) coeflabels( ,  interaction(" x ")) headings(2.group = "{bf:Treatment}" 1.war = "{bf:Interaction Effects with War Experience}" 1.northbirth = "{bf:Interaction Effects with War Displacement}", labsize(vsmall)) ylab(, labs(vsmall)) 
graph export "int_index_all.pdf", replace

***** FIGURE A.1
kdensity avgimm_recode2

***** FIGURE A.2
twoway histogram age, by(war) || kdensity age

***** FIGURE A.3
reg C2_recode i.group war northbirth $control , robust 
estimate store main2_2
reg C3_v2_recode i.group war northbirth $control , robust 
estimate store main3_2
reg C5_recode i.group war northbirth $control , robust 
estimate store main5_2
reg D4_recode i.group war northbirth $control , robust 
estimate store main6_2
reg C11_v2_recode i.group war northbirth $control , robust 
estimate store main7_2
reg avgimm_recode2 i.group war northbirth $control, robust 
estimate store main_index_2

coefplot (main2_2), bylabel("Increase Number of Asylum Seekers") || (main3_2), bylabel("Increase Number of Refugees") || (main6_2), bylabel("Accept Yemeni Refugees") || (main5_2), bylabel("Send Aid to Assist Refugees") || (main7_2), bylabel("Spending on Refugees a Priority")|| (main_index_2), bylabel("Pro-Refugee Index") ||, subtitle(, size(vsmall)) levels(95 90) msym(s) mfcolor(white) ciopts(lwidth(*1 *3)) keep(2.group 3.group 4.group 5.group 6.group 7.group 8.group war northbirth) byopts(xrescale) xline(0) xlabel(-0.1(0.05)0.20) drop(_cons) headings(2.group = "{bf:Treatment}" war = "{bf:Conflict Experience}", labsize(vsmall)) ylab(, labs(vsmall))
graph export "main_all.pdf", replace

***** FIGURE A.4: MANIPULATION CHECK - SHARED EXPERIENCE
reg C13_recode i.group war northbirth $control , robust
estimate store empathy_manip
tab C13 if group == 1

* coefficient size of information treatment % of the average of suffering question
su C13_recode
di  -.0395492 /.705375  

coefplot (empathy_manip), levels(95 90) msym(s) mfcolor(white) ciopts(lwidth(*1 *3)) keep(2.group 3.group 4.group 5.group 6.group 7.group 8.group) title("Koreans Have Suffered More Historically than Others", size(medium)) byopts(xrescale) xline(0) drop(_cons) headings(shame = "{bf:Treatment}")
graph export "manip_emp.pdf", replace

***** FIGURE A.5: MANIPULATION CHECK - INFORMATION
reg know_share i.group war northbirth $control ,  robust
estimate store shame_all
count if E4 > 2 & group == 1
count if group == 1

* coefficient size of information treatment % of the average of knowledge
su know_share
di  .23/.0875 

coefplot (shame_all), levels(95 90) msym(s) mfcolor(white) ciopts(lwidth(*1 *3)) keep(2.group 3.group 4.group 5.group 6.group 7.group 8.group) title("Correct Number of Asylum Seekers", size(medium)) byopts(xrescale) xline(0) drop(_cons) headings(2.group = "{bf:Treatment}")
graph export "manip_shame_all.pdf", replace

***** FIGURE A.6: MANIPULATION CHECK - ECONOMY
reg C7_recode i.group war northbirth $control , robust
estimate store economic_manip
test 4.group = 8.group
tab C7 if group == 1

coefplot (economic_manip), levels(95 90) msym(s) mfcolor(white) ciopts(lwidth(*1 *3)) keep(2.group 3.group 4.group 5.group 6.group 7.group 8.group) title("Refugees Can Help the Economy", size(medium)) byopts(xrescale) xline(0) drop(_cons) headings(2.group = "{bf:Treatment}")
graph export "manip_econ_all.pdf", replace

***** FIGURE A.7: PLACEBO
reg C30_recode i.group war northbirth $control, robust
estimate store placebo_all
coefplot (placebo_all), levels(95 90) msym(s) mfcolor(white) ciopts(lwidth(*1 *3)) keep(2.group 3.group 4.group 5.group 6.group 7.group 8.group) title("Policy Attitude: University Admissions", size(medium)) xlabel(-0.1(0.05)0.15) byopts(xrescale) xline(0) drop(_cons) headings(2.group = "{bf:Treatment}" war = "{bf:Conflict Experience}")
graph export "placebo_all.pdf", replace


************************* OTHER ANALYSES *************************
***** FOOTNOTE 28
* cultural threat strong mediator
set more off
medeff (regress C20 war group2-group8 northbirth $control) (regress avgimm_recode2 war C20 group2-group8 northbirth $control), treat(war) mediate(C20) vce(robust) 

/*
------------------------------------------------------------------------------------
        Effect                 |  Mean           [95% Conf. Interval]
-------------------------------+----------------------------------------------------
        ACME                   | -.0134976     -.0244046      -.002925
        Direct Effect          | -.0064744     -.0242021      .0099123
        Total Effect           | -.0199719     -.0404982      .0000104
        % of Tot Eff mediated  |  .6686039     -.4480968      3.326686
------------------------------------------------------------------------------------
*/

* crime threat strong mediator
set more off
medeff (regress C21 war group2-group8 northbirth $control) (regress avgimm_recode2 war C21 group2-group8 northbirth $control), treat(war) mediate(C21) vce(robust) 

/*
------------------------------------------------------------------------------------
        Effect                 |  Mean           [95% Conf. Interval]
-------------------------------+----------------------------------------------------
        ACME                   | -.0167143     -.0281264     -.0059525
        Direct Effect          | -.0032541     -.0209515      .0131046
        Total Effect           | -.0199684     -.0408324      .0001083
        % of Tot Eff mediated  |  .8320668     -.5330319      4.275192
------------------------------------------------------------------------------------
*/

* security threat strong mediator
set more off
medeff (regress C22 war group2-group8 northbirth $control) (regress avgimm_recode2 war C22 group2-group8 northbirth $control), treat(war) mediate(C22) vce(robust) 

/*
------------------------------------------------------------------------------------
        Effect                 |  Mean           [95% Conf. Interval]
-------------------------------+----------------------------------------------------
        ACME                   | -.0143098     -.0243348     -.0048602
        Direct Effect          | -.0056629     -.0241015      .0113809
        Total Effect           | -.0199727     -.0405442     -.0003737
        % of Tot Eff mediated  |  .7060184      .2903481      3.604386
------------------------------------------------------------------------------------
*/

* desire for monolitic society mediates
set more off
medeff (regress C25 war group2-group8 northbirth $control) (regress avgimm_recode2 war C25 group2-group8 northbirth $control), treat(war) mediate(C25) vce(robust) 

/*
------------------------------------------------------------------------------------
        Effect                 |  Mean           [95% Conf. Interval]
-------------------------------+----------------------------------------------------
        ACME                   | -.0095476     -.0172702     -.0015133
        Direct Effect          | -.0104305     -.0297692      .0074453
        Total Effect           | -.0199781      -.040603     -.0007124
        % of Tot Eff mediated  |  .4730817      .2081522      2.452369
------------------------------------------------------------------------------------
*/
****** MEDIATORS OF DISPLACED BY WAR MODERATION
xi: reg avgimm_recode2 i.group war northbirth $control, robust

set more off
foreach var of varlist _Igroup_2-_Igroup_8 {
gen war_`var' = war*`var'
gen nk_`var' = northbirth*`var'
  }
  
* Cultural threat 
set more off
medeff (regress C20 _Igroup_2 _Igroup_3 _Igroup_4 _Igroup_5 _Igroup_6 _Igroup_7 _Igroup_8 war__Igroup_2 nk__Igroup_2 war__Igroup_3 nk__Igroup_3 war__Igroup_4 nk__Igroup_4 war__Igroup_5 nk__Igroup_5 war__Igroup_6 nk__Igroup_6 war__Igroup_7 nk__Igroup_7 war__Igroup_8 nk__Igroup_8 war northbirth $control) (regress avgimm_recode2 C20 _Igroup_2 _Igroup_3 _Igroup_4 _Igroup_5 _Igroup_6 _Igroup_7 _Igroup_8 war__Igroup_2 nk__Igroup_2 war__Igroup_3 nk__Igroup_3 war__Igroup_4 nk__Igroup_4 war__Igroup_5 nk__Igroup_5 war__Igroup_6 nk__Igroup_6 war__Igroup_7 nk__Igroup_7 war__Igroup_8 nk__Igroup_8 war northbirth $control), treat(nk__Igroup_2) mediate(C20) vce(robust) 
/*
------------------------------------------------------------------------------------
        Effect                 |  Mean           [95% Conf. Interval]
-------------------------------+----------------------------------------------------
        ACME                   |  .0660765     -.0067877      .1416135
        Direct Effect          |  .1317766     -.0013313      .2715166
        Total Effect           |  .1978531      .0523111      .3477075
        % of Tot Eff mediated  |  .3351946      .1892026      1.244765
------------------------------------------------------------------------------------
*/

* Crime threat 
set more off
medeff (regress C21 _Igroup_2 _Igroup_3 _Igroup_4 _Igroup_5 _Igroup_6 _Igroup_7 _Igroup_8 war__Igroup_2 nk__Igroup_2 war__Igroup_3 nk__Igroup_3 war__Igroup_4 nk__Igroup_4 war__Igroup_5 nk__Igroup_5 war__Igroup_6 nk__Igroup_6 war__Igroup_7 nk__Igroup_7 war__Igroup_8 nk__Igroup_8 war northbirth $control) (regress avgimm_recode2 C21 _Igroup_2 _Igroup_3 _Igroup_4 _Igroup_5 _Igroup_6 _Igroup_7 _Igroup_8 war__Igroup_2 nk__Igroup_2 war__Igroup_3 nk__Igroup_3 war__Igroup_4 nk__Igroup_4 war__Igroup_5 nk__Igroup_5 war__Igroup_6 nk__Igroup_6 war__Igroup_7 nk__Igroup_7 war__Igroup_8 nk__Igroup_8 war northbirth $control), treat(nk__Igroup_2) mediate(C21) vce(robust) 

/*
------------------------------------------------------------------------------------
        Effect                 |  Mean           [95% Conf. Interval]
-------------------------------+----------------------------------------------------
        ACME                   |  .1043398      .0285235       .184167
        Direct Effect          |  .0934562     -.0491647      .2431831
        Total Effect           |   .197796      .0442048       .357435
        % of Tot Eff mediated  |  .5268781      .2884391      2.206472
------------------------------------------------------------------------------------
*/

* Security threat 
set more off
medeff (regress C22 _Igroup_2 _Igroup_3 _Igroup_4 _Igroup_5 _Igroup_6 _Igroup_7 _Igroup_8 war__Igroup_2 nk__Igroup_2 war__Igroup_3 nk__Igroup_3 war__Igroup_4 nk__Igroup_4 war__Igroup_5 nk__Igroup_5 war__Igroup_6 nk__Igroup_6 war__Igroup_7 nk__Igroup_7 war__Igroup_8 nk__Igroup_8 war northbirth $control) (regress avgimm_recode2 C22 _Igroup_2 _Igroup_3 _Igroup_4 _Igroup_5 _Igroup_6 _Igroup_7 _Igroup_8 war__Igroup_2 nk__Igroup_2 war__Igroup_3 nk__Igroup_3 war__Igroup_4 nk__Igroup_4 war__Igroup_5 nk__Igroup_5 war__Igroup_6 nk__Igroup_6 war__Igroup_7 nk__Igroup_7 war__Igroup_8 nk__Igroup_8 war northbirth $control), treat(nk__Igroup_2) mediate(C22) vce(robust) 

/*
------------------------------------------------------------------------------------
        Effect                 |  Mean           [95% Conf. Interval]
-------------------------------+----------------------------------------------------
        ACME                   |  .0585261      .0004406      .1190098
        Direct Effect          |  .1394997     -.0145366      .3012109
        Total Effect           |  .1980258      .0430571      .3655742
        % of Tot Eff mediated  |  .2946352      .1557421      1.301885
------------------------------------------------------------------------------------
*/

